[% setvar title Ordered bytecode %]
<div id="archive-notice">
    <h3>This file is part of the Perl 6 Archive</h3>
    <p>To see what is currently happening visit <a href="http://www.perl6.org/">http://www.perl6.org/</a></p>
</div>
<div class='pod'>
<a name='TITLE'></a><h1>TITLE</h1>
<p>Ordered bytecode</p>
<a name='VERSION'></a><h1>VERSION</h1>
<pre>  Maintainer: Simon Cozens &lt;<a href='mailto:simon@brecon.co.uk'>simon@brecon.co.uk</a>&gt;
  Date: 25 Sep 2000
  Mailing List: <a href='mailto:perl6-internals@perl.org'>perl6-internals@perl.org</a>
  Number: 310
  Version: 1
  Status: Developing</pre>
<a name='ABSTRACT'></a><h1>ABSTRACT</h1>
<p>Bytecode should be structured in such a way that reading and executing
it can be parallelised.</p>
<a name='DESCRIPTION'></a><h1>DESCRIPTION</h1>
<p>(Note: this is slightly vague, and needs a bit of fleshing out. Help! :)</p>
<p>One of the speed problems with compiled Perl is that the whole op tree
needs to be read into memory before being run, and reading in bytecode
is slow. One solution would be to find a way of parallelising the
reading and the running.</p>
<p>This RFC revolves around the concept of basic blocks. Basic blocks are
portions of the code which will execute &quot;straight through&quot; without
looping or forking; they're areas where the PP code currently returns
<code>NORMAL</code>. In fact, the module <code>B::Bblock</code> walks basic blocks.</p>
<p>Now, there's always going to be one basic block which kicks off the
action; in Perl 5, it's the basic block from <code>PL_mainroot</code>. This should
come first in the bytecode. After that, should come a small marker that
this is the end of the basic block, and the offsets of the next possible
blocks.</p>
<p>This means that the VM can do at least a bit of the runtime while it's
reading in the other possibilities; by the time the bytecode for the
other possible paths is read in and ready to run, the previous bblock
should have completed its run. The bytecode output should be
arranged so that related blocks come as close to each other as possible,
so that it's possible to seek a near-sequential path through the
program.</p>
<a name='IMPLEMENTATION'></a><h1>IMPLEMENTATION</h1>
<p>As above...</p>
<a name='REFERENCES'></a><h1>REFERENCES</h1>
<p>&quot;Compilers&quot;, by Aho, Sethi and Ullman. <code>B::Bblock</code></p>
<p>RFC 302: Unrolling loops and tail recursion.</p>
</div>
